#include "head.h" 
void print_calculate(Node *phead_F, Node *phead_W){
	Node *p = phead_F->next;
	Wages *t = (Wages*)malloc(sizeof(Wages));
	t = (Wages*)phead_W->next->data;
	if(p != NULL){
		printf("姓名:\t基本工资:\t岗位津贴:\t物价补贴:\t职务补贴:\t住房补贴:\t病假扣款:\t事假扣款:\t旷工扣款:\t其他扣款:\t加班总费:\t夜班总费:\t实际工资:\n");
	}
	while(p){
		Faculty *s = (Faculty*)malloc(sizeof(Faculty));
		s = (Faculty*)p->data;
		printf("%s:\t+%-15d+%-15d+%-15d+%-15d+%-15d-%-15lf-%-15d-%-15d-%-15d+%-15d+%-15d%-15lf\n", s->name, t->basic, s->allowance, s->subsidies, s->duty, s->housing, s->sick, t->affair * s->affair_day, t->absenteeism * s->absenteeism_day, t->other, t->overtime * s->overtime_day, t->night * s->night_day ,s->realmoney);
		p = p->next;
	}
	return;
}

void print_individual(Node *phead_F, Node *phead_W, char *str){
	Node *p = phead_F->next;
	Wages *t = (Wages*)malloc(sizeof(Wages));
	t = (Wages*)phead_W->next->data;
	while(p){
		Faculty *s = (Faculty*)malloc(sizeof(Faculty));
		s = (Faculty*)p->data;
		if(strcmp(str, s->name) == 0){
			printf("姓名:\t基本工资:\t岗位津贴:\t物价补贴:\t职务补贴:\t住房补贴:\t病假扣款:\t事假扣款:\t旷工扣款:\t其他扣款:\t加班总费:\t夜班总费:\t实际工资:\n");
			printf("%s:\t%-16d%-16d%-16d%-16d%-16d%-16lf%-16d%-16d%-16d%-16d%-16d%-16lf\n", s->name, t->basic, s->allowance, s->subsidies, s->duty, s->housing, s->sick, t->affair * s->affair_day, t->absenteeism * s->absenteeism_day, t->other, t->overtime * s->overtime_day, t->night * s->night_day ,s->realmoney);
			return;
		}
		p = p->next;
	}
	printf("查无此人!"); 
	return; 
} 

void print_sector(Node *phead_F, Node *phead_W, char *str){
	Node *p = phead_F->next;
	Wages *t = (Wages*)malloc(sizeof(Wages));
	t = (Wages*)phead_W->next->data;
	if(p != NULL){
		printf("姓名:\t基本工资:\t岗位津贴:\t物价补贴:\t职务补贴:\t住房补贴:\t病假扣款:\t事假扣款:\t旷工扣款:\t其他扣款:\t加班总费:\t夜班总费:\t实际工资:\n");
	}
	while(p){
		Faculty *s = (Faculty*)malloc(sizeof(Faculty));
		s = (Faculty*)p->data;
		if(strcmp(str, s->sector) == 0){
			printf("%s:\t%-16d%-16d%-16d%-16d%-16d%-16lf%-16d%-16d%-16d%-16d%-16d%-16lf\n", s->name, t->basic, s->allowance, s->subsidies, s->duty, s->housing, s->sick, t->affair * s->affair_day, t->absenteeism * s->absenteeism_day, t->other, t->overtime * s->overtime_day, t->night * s->night_day ,s->realmoney);
		}
		p = p->next;
	}
	return;
}

void print_school(Node *phead_F, Node *phead_W){
	Node *p = phead_F->next;
	Wages *t = (Wages*)malloc(sizeof(Wages));
	t = (Wages*)phead_W->next->data;
	if(p != NULL){
		printf("姓名:\t基本工资:\t岗位津贴:\t物价补贴:\t职务补贴:\t住房补贴:\t病假扣款:\t事假扣款:\t旷工扣款:\t其他扣款:\t加班总费:\t夜班总费:\t实际工资:\n");
	}
	while(p){
		Faculty *s = (Faculty*)malloc(sizeof(Faculty));
		s = (Faculty*)p->data;
		printf("%s:\t%-16d%-16d%-16d%-16d%-16d%-16lf%-16d%-16d%-16d%-16d%-16d%-16lf\n", s->name, t->basic, s->allowance, s->subsidies, s->duty, s->housing, s->sick, t->affair * s->affair_day, t->absenteeism * s->absenteeism_day, t->other, t->overtime * s->overtime_day, t->night * s->night_day ,s->realmoney);
		p = p->next;
	}
	return;
}